var myChart1 = echarts.init(document.getElementById('projectOrderChart'));
var myChart2 = echarts.init(document.getElementById('projectOrderCountChart'));
var orderCount = $('#orderCount');
var orderProcessCount = $('#orderProcessCount');
function myChartFunc(data) {
    return  {
        title:{
            text:'本月各设备运维情况',
            textStyle:{
                color:'#33FFFF'
            },
            left:'center'
        },
        color: ['#FF4F64','#FF9D1B', '#FF6426', '#2545E7', '#8356E4'],
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data: ['告警','巡检','维修'],
            top:'30px',
            textStyle:{
                color:'#fff'
            }
        },
        toolbox: {
            show : true,
            feature : {
                dataView : {show: true, readOnly: false},
                magicType : {show: true, type: ['line', 'bar']},
                restore : {show: true},
                saveAsImage : {show: true}
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis:  {
            type: 'value',
            axisLabel:{
                color:'#fff'
            },
            splitLine:{
                show:false
            },
        },
        yAxis: {
            type: 'category',
            axisLabel:{
                color:'#fff'
            },
            data: data.dataName
        },
        series: [
            {
                name: '告警',
                type: 'bar',
                stack: '次数',
                label: {
                    normal: {
                        show: false,
                        position: 'insideRight'
                    }
                },
                data:data.alarmData
            },
            {
                name: '巡检',
                type: 'bar',
                stack: '次数',
                label: {
                    normal: {
                        show: false,
                        position: 'insideRight'
                    }
                },
                data: data.patrolData
            },
            {
                name: '维修',
                type: 'bar',
                stack: '次数',
                label: {
                    normal: {
                        show: false,
                        position: 'insideRight'
                    }
                },
                data: data.repairData
            },


        ]
    };
}
function myChart2Func(data){
   return   {
        title:{
            text:'本月运维数量趋势',
            textStyle:{
                color:'#33FFFF'
            },
            left:'center'
        },
        color: ['#FF4F64','#FF9D1B', '#FF6426', '#2545E7', '#8356E4'],
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data: ['告警','巡检','维修'],
            top:'30px',
            textStyle:{
                color:'#fff'
            }
        },
       toolbox: {
           show : true,
           feature : {
               dataView : {show: true, readOnly: false},
               magicType : {show: true, type: ['line', 'bar']},
               restore : {show: true},
               saveAsImage : {show: true}
           }
       },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        yAxis:  {
            type: 'value',
            axisLabel:{
                color:'#fff'
            },
            splitLine:{
                show:false
            }
        },
        xAxis: {
            type: 'category',
            axisLabel:{
                color:'#fff'
            },
            data:data.dateArr
        },
        series: [
            {
                name: '告警',
                type: 'bar',
                stack: '次数',
                label: {
                    normal: {
                        show: false ,
                        position: 'insideRight'
                    }
                },
                data:data.alarms
            },
            {
                name: '巡检',
                type: 'bar',
                stack: '次数',
                label: {
                    normal: {
                        show: false,
                        position: 'insideRight'
                    }
                },
                data: data.patrols
            },
            {
                name: '维修',
                type: 'bar',
                stack: '次数',
                label: {
                    normal: {
                        show: false,
                        position: 'insideRight'
                    }
                },
                data: data.repairs
            },

        ]
    };
}

/* $(function(){
	var dataJson = '48,46,43,49,45,41,47,48,49,40,41,48,48,49,47,45,48,48,49,42,47,42,43,50,45,49,47,44,49,51,48';
	var list = dataJson.split(',');
	var sum = 0;
	for(var i = 0;i<list.length;i++){
			sum += parseInt(list[i]);
	}
	console.log("sum:"+sum);
}) */
